package com.hd.service.impl;

import com.hd.controller.dto.NoticeInfoDto;
import com.hd.mapper.NoticeInfoMapper;
import com.hd.pojo.NoticeInfo;
import com.hd.service.NoticeInfoService;
import com.hd.tools.Pager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by 1 on 2017/12/1.
 */
@Service("noticeInfoService")
@Transactional
public class NoticeInfoServiceImpl implements NoticeInfoService{

    @Resource
    private NoticeInfoMapper noticeInfoMapper;


    @Override
    public Pager searchAllNoticerInfo(Integer offset, Integer limit, NoticeInfoDto dto) {
        Pager pager = new Pager();
        pager.setRows(noticeInfoMapper.searchNoticeInfo(offset,limit,dto));
        pager.setTotal(noticeInfoMapper.getTotal(dto));
        return pager;
    }

    @Override
    public void addNoticeInfo(NoticeInfo noticeInfo) {
        noticeInfoMapper.add(noticeInfo);
    }

    @Override
    public NoticeInfo viewNoticeInfo(Integer noticeId) {
        return noticeInfoMapper.viewNoticeInfo(noticeId);
    }
}
